perf: warn when stale ENDED sessions accumulate#746
Open
peyton-alt wants to merge 5 commits intomainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds detection of “stale” ENDED sessions (ENDED but not FullyCondensed) and emits a rate-limited warning to help users clean them up and avoid repeated PostCommit processing overhead.
Changes:
- Added
countStaleEndedSessionshelper to identify non-fully-condensed ENDED sessions. - Added rate-limited warning logic (24h sentinel in
.git/entire-sessions/) advisingentire clean --forceonce stale sessions exceed a threshold. - Added unit tests for stale-session counting and the warning rate-limit behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
cmd/entire/cli/strategy/manual_commit_session.go |
Adds helper to count stale ENDED sessions. |
cmd/entire/cli/strategy/manual_commit_hooks.go |
Implements warning + sentinel gating and triggers it during PostCommit. |
cmd/entire/cli/strategy/phase_postcommit_test.go |
Adds tests for counting stale sessions and rate-limited warning behavior. |
Add detection and rate-limited warning for non-FullyCondensed ENDED sessions that incur PostCommit processing cost on every commit. When >= 3 stale sessions are found, emit a stderr warning pointing users to 'entire clean --force'. Warning is rate-limited to once per 24h via a sentinel file in .git/entire-sessions/. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 7841b7892888
entire doctor handles ENDED sessions with uncondensed checkpoint data (condenses them to entire/checkpoints/v1). entire clean only removes orphaned sessions with no shadow branch, which wouldn't help here. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: cf6c460dff65
- Replace os.Stderr mutation with injectable stderrWriter package var - Add comment explaining intentional shadow branch re-check in isWarnableStaleEndedSession (PostCommit deletes branches mid-execution) - Replace map with slice in test for deterministic iteration order - Extract testTranscript constant to fix goconst lint - Add t.Chdir warning comments to non-parallel tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: d924cd6bb74b
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
f9f7f80 to
e52ce3f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When ENDED sessions still have uncondensed checkpoint data,
PostCommithasto keep processing them on every commit. This PR adds a user-facing warning
when those stale sessions accumulate, and points users to
entire doctor,which can condense them and restore normal commit performance.
What changed
PostCommitentire doctor.git/entire-sessions/so the warning onlyappears at most once per 24 hours
entire doctorinstead ofentire clean --forcePostCommitalready condensed and cleaned up
Stale ENDED sessions with shadow-branch state create avoidable
PostCommitwork on every user commit. The CLI should surface that degradation before it
piles up, but only when the sessions are still actually fixable and still
present after the current commit finishes processing.
Testing
go test ./cmd/entire/cli/strategyNotes